package java68_6;

public class Teacher {
    private String name;
    private int age;
    public void selfIntro(){
        System.out.println("我的名字叫"+name+",今年"+age+"岁");
        showCixiu();//ok
    }
    //读
    public String getName(){
        return name;
    }
    //写
    public void setName(String n){
        this.name=n;
    }
//    public void setName(String name){
//        this.name=name;
//    }
    public int getAge(){
        return age;
    }
    //限制年龄不能小于22岁
    public void setAge(int a){
        if(a<22){
            System.out.println("年龄太小了,才"+a+"岁");
            a=22;
        }
        age=a;
    }

    private void  showCixiu(){
        System.out.println(name+"在大腿上有纹身");
    }
}
